Fix: Text parameter input cleared in the copy flyout#36
Merged
Conversation
In the parameter-fill flyout each row rendered both a TextBox and a ComboBox, visibility-toggled on the parameter type. Collapsed elements keep their bindings live, so for a Text parameter the hidden ComboBox stayed two-way bound to the same `Value`: every keystroke set `Value`, the ComboBox couldn't find it in its (empty) Options, coerced SelectedItem to null and wrote null back — clearing the TextBox and leaving the command unresolved, so Copy never enabled. (The snip editor was unaffected: its Type dropdown binds a different property.) Realise only the control the parameter type needs via x:Load, so the unused control is never created and its binding never fires. Typed values now stick, the preview resolves, and Copy enables. Add a Core regression test covering a path-like value (quotes, backslashes, spaces) resolving and enabling copy on the view-model/engine side. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
In the Copy parameter-fill flyout, a Text parameter's box cleared itself on every keystroke and the Copy button never enabled. Symptoms: the caret shows (focus is fine), typing clears the box, a single Ctrl+V clears it, a double Ctrl+V leaves text visible — but the Preview still shows the raw
{token}and Copy stays disabled.Cause
Each row in the flyout rendered both a
TextBoxand aComboBox, toggled withVisibility. ButVisibility="Collapsed"does not deactivate a binding — so for a Text parameter the hidden ComboBox stayedSelectedItem="{x:Bind Value, Mode=TwoWay}"bound to the sameValueas the TextBox:Valueis set →PropertyChangedfires.Value, can't find it in its (empty)Options, and coercesSelectedItemto null — writing null back intoValue.Valuestays null → token unresolved → Preview keeps{token}and Copy never enables.The snip editor was unaffected because its Type dropdown binds a different property (
TypeIndex). This was long-standing — Text params in the flyout never accepted typing; it only surfaced now that imported snips are the first that need a typed value rather than a default or a choice.Fix
A parameter row is either Text or Choice, fixed for its lifetime. Realise only the relevant control via
x:Load, so the unused control is never created and its binding never fires. Typed values now stick, the preview resolves live, and Copy enables.Testing
IsCopyEnabledbecomes true. (The bug itself was in XAML binding; this guards the view-model/engine side.)🤖 Generated with Claude Code